import React from 'react';
import PropTypes from 'proptypes';
import style from './index.css';
const TabSwitch = props => {
    const { tabs } = props;
    return (
        <div className={style.tabswitch}>
            {
                tabs.map((item, index) => {
                    return (
                        <span onClick={ item.onClick} key={index} className={style.item}> { item.name }</span>
                    )
                })
            }
        </div>
    )
}

TabSwitch.defaultProps = {
    tabs: [{
        name: 'tab one',
    }, {
        name: 'tab two',
    }, {
        name: 'tab three'
    }]
}
TabSwitch.propTypes = {
    tabs: PropTypes.arrayOf(PropTypes.shape({
        name: PropTypes.string,
        onClick: PropTypes.onClick
    }))
}


export default TabSwitch;
